<?php include_once './application/views/sys_admin/common/header.php';  ?>
<!-- admin_main -->
<div class=" definewidth m20">
	<form id="rechargeForm" name="rechargeForm" >
		<table class="table table-bordered table-hover m10">
		 <tr>
	        <td class="tableleft">用户名</td>
	        <td> <input type="text" name="username" id="username" size="50"  /></td>
	        <td class="tableleft">金额</td>
	        <td><input type="text" name="money" id="money" size="50" /> </td>
	        
	   	</tr>
	   	<tr>
	        <td class="tableleft">备注</td>
	        <td colspan="2" ><input type="text" name="remark" id="remark" size="100" /> </td>
	        <td> <button type="button" class="btn btn-success"  onclick="rechargesub();" >提交</button></td>
	        
	   	</tr>
	   	</table>
	</form>
</div> 
<script type="text/javascript">
function rechargesub(){
	var options = {
		url : '/sys_admin/accountrecharge/sendred/',
		clearForm :true,
		resetForm :true,
		beforeSubmit:  checkForm,
		dataType: "json",
		type:"post",
		success : function(ret) {
			if(ret.msg==''){
				$('#dialog').dialog({
					modal:true,
					title:'系统提示',
					buttons:{"确定":function(){$(this).dialog("close");}}
				}); 
				$("#msg").html("操作成功");
			}else{
				$('#dialog').dialog({
					modal:true,
					title:'系统提示',
					buttons:{"确定":function(){$(this).dialog("close");}}
				}); 
				$("#msg").html(ret.msg);
			}
		}
	};
	$("#rechargeForm").ajaxSubmit(options);
	return false;
}

function checkForm(){
	var err = '';
	if($('#username').val()==''){
		err = '请填写有效的用户名';
	}else if(IsDouble($('#money').val())==false){
		err = '请填写有效的金额';
	}else if($('#remark').val()==''){
		err = '请填写备注';
	}
	if(err==''){
		return true;
	}else{
		$('#dialog').dialog({
			modal:true, //蒙层（弹出会影响页面大小）
			title:'系统提示',
			buttons:{"确定":function(){$(this).dialog("close");}}
		}); 
		$("#msg").html(err);
		return false;
	}
}
</script>
<div id="dialog" title="系统提示" style="display:none"><p id="msg" style="text-align:center"></p></div>
